home *** CD-ROM | disk | FTP | other *** search
- INTRODUCTION
-
- CodePrint for C is a command-line driven source code reformatter and pretty
- printer for the C programming language. As a source code reformatter,
- CodePrint can quickly standardize the look of your source code. As a pretty
- printer, CodePrint can enhance the readabilty of your printouts. It can assist
- you in understanding code during maintenance and debugging and it's a great way
- to print out final source code listings. CodePrint offers you many optional
- customization features, enabling you to format code the way you want to see it.
- The program provides on-line help, user-friendly error messages, batch
- processing and print spooling to make the program easy to use.
-
- - Reformatter
-
- The reformatting features include syntax driven auto-indenting, selection
- of indent style, alignment of comments, editable keyword templates,
- adjustable tab spacing and line editing for consistent whitespace.
-
- - Pretty Printer
-
- The pretty printer optional features include flow lines to enhance the
- visualization of code structure, a header with filename, time and date,
- page breaks, page numbers, form feeds, condensed printing, doublestrike
- printing of keywords, emphasized printing of executable code, italic print-
- ing of function identifiers, adjustable margins and line numbers.
-
- - On-Line Help
-
- The on-line help provides you with CodePrint command syntax and command-
- line options.
-
- - Batch Processing and Spooling
-
- You can format and/or pretty print your files in batch mode by entering
- more than one file name on the command line, by using DOS wild cards or by
- specifying a file list. CodePrint will process as many files as the print
- buffer will hold. And because CodePrint makes use of the DOS print spooler,
- you don't have to wait for the printer to finish before you can continue to
- use your computer.
-
- - Error Messages
-
- CodePrint provides user-friendly error messages with suggestions for
- corrective actions to assist you.
-
-
-
- SYSTEM REQUIREMENTS
-
- - An IBM Personal Computer or "compatible" running MS-DOS or PC-DOS
- Version 3.1 or later.
-
- - A dot matrix, daisy wheel or laser printer is required for the pretty
- printer features. CodePrint provides support for Epson FX, IBM Proprinter,
- HP LaserJet Series II, Diablo 630, NEC 3550 and Qume Sprint 11 printer
- emulations.
-
- - A hard disk drive.
-
- - 512K bytes installed memory.
-
-
-
- DISK CONTENTS
-
- The following files are included on your product disk. You will also find these
- files listed in the file named PACKING.LST.
-
- File Name Description
-
- CP.EXE CodePrint reformatter and pretty printer.
- CP.DOC CodePrint documentation.
- C.DEF The keyword template for ANSI Standard C.
- C.MS The keyword template for Microsoft C and QuickC.
- C.BOR The keyword template for Borland Turbo C.
- INSTALL.EXE The installation program.
- PACKING.LST The list of all files included on the product disk.
- LICENSE.DOC The CodePrint license agreement.
- ORDER.DOC The CodePrint order form.
- SHAREW.ARE The Shareware description and license agreement.
- OMBUDS.MAN The ASP Ombudsman policy.
- PROBLEM.RPT The CodePrint problem report form.
- READ.ME The information you should read before using CodePrint.
-
-
- INSTALLING CodePrint
-
- - Executing the Install Program
-
- An install program is provided for loading CodePrint onto your hard disk.
- First load the product disk into your disk drive. Enter the letter
- designation of the drive for the product disk, followed by a colon and
- press ENTER. Then type INSTALL as shown below:
-
- C> A:
- A> INSTALL
-
- The install program will:
-
- (1) Prompt you for information about source and destination drives.
- (2) Prompt you for information about your printer.
- (3) Prompt you for information about your compiler.
- (4) Create new directories on your hard drive.
- (5) Copy program and support files to your hard drive.
- (6) Create an initialization file, CPINI.BAT, and place it in the
- default directory.
- (7) Add the instruction, CPINI, to your autoexec.bat.
-
- CodePrint options that reside in the CP environment are saved in an
- initialization file each time you run the program. The initialization file
- is activated when you reboot. The initialization file, CPINI.BAT will then
- restore the previous CP environment with the SET CP command. The setting
- for the destination drive is also restored with the SET DRIVE command.
-
-
- - Modifying Your AUTOEXEC.BAT File
-
- You will need to set a path to the main directory, the DOS directory and
- the CodePrint language directory. Add the following information to the
- path in your AUTOEXEC.BAT:
-
- PATH=C:\;C:\DOS;C:\CP\C;
-
- CodePrint makes use of the print spooler built into the DOS PRINT command.
- The PRINT /Q:queuesize switch controls the number of files that may be in
- the print queue at any one time. The allowable range is 1 to 32. The default
- is 10. To provide the maximum number of files in the print queue, add the
- following line to your AUTOEXEC.BAT:
-
- PRINT /Q:32
-
- - Check for DOS PRINT
-
- Since CodePrint makes use of the DOS PRINT command, you will need to check
- that PRINT.COM or PRINT.EXE has been loaded in the main directory C:\ or
- the DOS directory C:\DOS.
-
- - Check Your Printer Configuration
-
- Make sure that your printer is configured correctly by checking your
- printer manual for the proper internal switch settings. If you do not
- have a printer to match the list of available configurations, you may
- utilize your printer by using the default setting. However, many of the
- enhanced printer features are not available with the default setting.
-
-
- USING CodePrint
-
- The CodePrint program is issued from the DOS command line. The format for
- invoking CodePrint is:
-
- C> CP <filespec> [options]
-
- The file specification can be a single file, multiple files (separated by
- spaces), or the name of a file listing immediately preceded by the @ symbol.
- CodePrint will only accept file names with legal extensions. The legal
- extensions of filespec for C are ".C" and ".H".
-
- For example, a command to process a single C source file might be:
-
- C> CP MYFILE.C /F /J80
-
- or a command to process multiple C source files:
-
- C> CP FILE1.C FILE2.C FILE3.C /F /J80
-
- or a command to process a C source file listing:
-
- C> CP @MYFILES.LST /F /J80
-
- If you create a file listing, put each file name on a separate line. You can
- process as many files as the print buffer will handle.
-
- You may not want to type options each time you run the program. You can avoid
- the necessity for retyping the options by setting the CodePrint options just
- once with the DOS SET command. The format for permanently setting the CodePrint
- options in a DOS session is:
-
- C> SET CP=[options]
-
- For example:
-
- C> SET CP=/F /G1 /J80
-
- To check the contents of the environment simply enter SET from the DOS command
- line:
-
- C> SET
-
-
-
- CodePrint OPTIONS
-
- The following information is provided to assist you with the use of CP options.
- Each option suppresses one or more features of CodePrint. In the absence of
- these options all of the features are active and/or set to default values.
-
- /A AUTOINDENT
-
- The /A option suppresses the auto-indent feature. When the auto-
- indent feature is active, it provides syntax driven automatic
- indenting for code blocks and loops. The tab spacing for each
- indent level can be set with the /T option.
-
-
- /Bn PAGE BREAKS
-
- The /B option controls the pagebreak feature. The pagebreak feature
- provides a form feed at the end of each page for non-zero arguments.
- Page breaks occur at the end of each page length. The length of a
- page is set by the argument n. The default value for n is 60. You
- can suppress the pagebreak feature by entering 0 as an argument.
-
-
- /C CONDENSED PRINTING
-
- The /C option suppresses the condensed printing feature. When the
- condensed printing feature is active (and with the default carriage
- width), the option provides a 138 character page width if the
- printer is configured as an Epson FX or HP LaserJet Series II
- printer and a 96 character page width if the printer is configured
- as an IBM Proprinter. When condensed printing is inactive, the page
- width is limited to 80 characters. Condensed printing has no effect
- on Diablo 630, NEC 3550 and Qume Sprint 11 printer emulations.
-
-
- /D DOUBLESTRIKE PRINTING (of keywords)
-
- The /D option supresses the doublestrike printing feature. When the
- doublestrike printing feature is active, it provides for double-
- strike printing of keywords. Doublestrike printing is equivalent to
- the BOLD typeface.
-
-
- /E EMPHASIZED PRINTING (of executable code)
-
- The /E option suppresses the emphasized printing feature. When the
- emphasized printing feature is active, it provides for emphasized
- printing of executable code. Emphasized printing is equivalent to
- the MEDIUM typeface.
-
-
- /F FLOW LINES
-
- The /F option suppresses the flow lines feature. When this feature
- is active, it provides flow lines for visualizing code blocks and
- loops. The vertical flow lines feature is dependent on the auto-
- indent feature being active.
-
-
- /Gn PRINTER CONFIGURATION
-
- The /G option suppresses the printer configuration feature. You
- will need to set this option to match the dip switch settings on
- your printer. If you are not familiar with how to configure you
- printer, consult your printer manual. Then set the dip switches in
- your printer accordingly.
-
- Value of n Printer Configuration (Emulation)
-
- 0 Other (default)
- 1 Epson FX
- 2 IBM Proprinter
- 3 HP LaserJet Series II
- 4 Diablo 630
- 5 NEC 3550
- 6 Qume Sprint 11
-
- The special printing features (COMPRESSED, DOUBLESTRIKE, EMPHASIZED,
- ITALICS and UNDERLINE) are not valid for the default printer
- configuration. The italics printing feature is not a valid feature
- of the IBM, DIABLO and NEC printer configurations.
-
-
- /H HEADER
-
- The /H option suppresses the header feature. When the header
- feature is active, it provides for a header at the top of each file
- listing. The header consists of the filename, time and date that
- the file was printed.
-
-
- /I ITALIC PRINTING (of function identifiers)
-
- The /I option suppresses the italicized printing feature. When the
- italicized printing feature is active, it provides for italicized
- printing of function identifiers.
-
-
- /Jn JUSTIFICATION (of in-line comments)
-
- The /J option controls the justification (alignment) of in-line
- comments. If you want comments to be left justifed then n must be a
- positive integer. If you want comments to be right justified then n
- must be a negative integer. If n=0, then a tab is placed between
- the end of the executable code and the beginning of each comment.
- If n is non-zero, it represents the number of characters from the
- left or right edge of the printout. The default is n=-1, leaving
- all in-line comments aligned on the first column at the right edge
- of the paper.
-
- Value of n Effect On In-line Comments
-
- zero Tab before each comment
- positive Left justified comment on column n (from left)
- negative Right justified comment on column n (from right)
-
- The justification feature is dependent on the autoindent feature
- being active.
-
-
- /Kn KEYWORD TEMPLATE
-
- The /K option controls the keyword template feature. The keyword
- template feature provides a limited selection of keyword templates
- supporting popular C compilers. You may also edit these files. The
- default is n=0, resulting in the use of a default keyword file.
-
- Value of n C Keyword Template Support
-
- 0 C.DEF ANSI Standard C
- 1 C.MS Microsoft C and QuickC
- 2 C.BOR Borland Turbo C
-
-
- /L LINE NUMBER
-
- The /L option suppresses the line numbers feature. When the line
- numbers feature is active, it provides for line numbers to be
- displayed at the beginning of each line of code.
-
-
- /Mn MARGIN
-
- The /M option controls the margin feature. The value n sets the
- number of characters to indent. The default is n=0, or no margin.
-
-
- /N PAGE NUMBERS
-
- The /N option suppresses the page numbers feature. When the page
- numbers feature is active, it provides page numbers at the bottom
- center of each page. The page numbers feature is dependent on the
- page break feature being active.
-
-
- /O OPTIONS
-
- The /O option suppresses the options listing feature. When the
- options listing feature is active, it provides a list of the option
- status in the header. The options features is dependent on the
- header feature being active.
-
-
- /Pn PRINTER PORT
-
- The /P option controls the printer port status check activated
- prior to printing. The value n sets the number of the printer port
- to check. The default is 0, the DOS printer port LPT1. You can
- suppress the print feature altogether by assigning an invalid
- printer port to n.
-
- Value of n Printer Port
-
- 0 LPT1
- 1 LPT2
- 2 LPT3
- 3 COM1
- 4 COM2
- 5 COM3
- 6 COM4
-
- The COM1, COM2, COM3 ports work only for IBM PCs and true
- compatibles. The COM4 port is available for IBM PS/2s.
-
-
- /Q QUICK PRINT
-
- The /Q option activates the quick print macro. When the quick
- print feature is active, it provides a quick printout of the
- destination file by cancelling the following enhanced printing
- features: doublestrike, emphasized, italicized and underlined
- printing. This is equivalent to the /D /E /I /U options.
-
-
- /R REFORMAT
-
- The /R option activates the reformatting macro. It provides for
- reformatting of source files by cancelling all pretty printing
- features including: page breaks, doublestrike and emphasized
- printing, form feeds, header, italicicized printing,line numbers,
- margin, page numbers, printing, underlined printing and flow lines.
- This is equivalent to the /B0 /D /E /F /H /I /L /M /N /P-1 /U /V /X
- options.
-
-
- /S SPACES
-
- The /S option suppresses the spaces feature. When the space feature
- is active, it provides consistent whitespace editing for each line
- of code. The spaces feature is dependent on the auto-indent feature
- being active.
-
-
- /Tn TAB SPACING
-
- The /T option controls the tab spacing feature. The tab spacing
- feature specifies the number of spaces per indent level. The
- default is n=4. The tab spacing feature is dependent on the auto-
- indent feature being active.
-
-
- /U UNDERLINE
-
- The /U option suppresses the underlined printing feature. When the
- underline feature is active, it provides for underlined printing of
- subroutine identifiers.
-
-
- /Vn TAB CONVERSION
-
- The /V option controls the tab conversion feature. CodePrint
- replaces any tabs it finds in the source file with an equivalent
- number of spaces in the destination file. The value n specifies the
- number of spaces that are used to replace tabs. The default is n=8,
- resulting in 8 spaces per tab. The spaces feature is dependent on
- the auto-indent feature being active.
-
-
- /Wn CARRIAGE WIDTH
-
- The /W option controls the carriage width option. The carriage
- width option specifies the width of the printed page in decimal
- inches. Legal values for carriage width are between 1.0 and 18.0
- inches. The default value of 8.0 inches allows for 1/4" margins
- on each side of an 8-1/2" sheet of paper.
-
-
- /X EXTRA FORM FEED
-
- The /X option suppresses the extra form feed feature. When the
- extra form feed feature is active, it provides for a form feed at
- the end of each file printed.
-
-
- /Yn INDENT STYLE
-
- The /Y option controls the indent style of the formatted source
- code.
-
- Value of n Description Example
-
- 0 No Effect if (<condition>) {<statement>}
-
- 1 Standard if (<condition>) {
- K&R Indent <statement>
- Style }
-
- 2 Braces on if (<condition>)
- Separate Lines {
- Aligned with <statement>
- Keyword }
-
- 3 Braces on if (<condition>)
- Separate Lines {
- Indented Beyond <statement>
- Keyword }
-
-
-
- CodePrint OPTIONS ARRANGED BY CATEGORY
-
- - REFORMAT OPTIONS
-
- The options listed below provide control of the CodePrint reformatting
- feature.
-
- /A Autoindent /Jn Justification
- /Kn Keyword Templates /R Reformat
- /S Spaces /Tn Tab Spacing
- /Vn Tab Conversion
-
-
- - PRETTY PRINT OPTIONS
-
- The options listed below in addition to the reformat options above provide
- control of the CodePrint pretty printing feature.
-
- /D Doublestrike /E Emphasized
- /I Italicized
-
-
- - ADDITIONAL PRINT CONTROL OPTIONS
-
- The options listed below provide additional print control.
-
- /Bn Page Breaks /C Compressed
- /F Flow Lines /Gn Configuration
- /H Header /L Line Numbers
- /Mn Margin /N Page Numbers
- /O Options /Pn Printer Port
- /Q Quick Print /W Carriage Width
- /Xn Extra Form Feed
-
-
- REFORMATTER
-
- The /R option should be used when you wish to format source code. This option
- cancels all printing options, leaving only reformatting options toggled on.
- The /R option is equivalent to /B0 /D /E /H /I /L /M /N /P-1 /W /X. If you
- wish to customize the formatting of your source code you may use one or more
- of the following options in addition to the /R option:
-
- /A Auto Indent
- /Jn Justification
- /Kn Keyword Template
- /S Spaces
- /Tn Tab
- /V Tab Conversion
-
-
- PRETTY PRINTER
-
- All of the CP options are valid for pretty printing with two exceptions. You
- cannot use the /P option or the /R option. The /P option with an invalid
- argument cancels printing and the /R option cancels all of the printing
- options.
-
-
- ON-LINE HELP
-
- CodePrint provides you with on-line help displaying CP command syntax and
- command-line options. To invoke the on-line help just type:
-
- C> CP
-
- and press enter.
-
-
- BATCH PROCESSING AND SPOOLING
-
- CodePrint provides you with three methods of batch processing. First, you may
- enter more than one file on the command line. The command line is limited by
- DOS to 128 bytes. The file names must be separated by spaces. For example:
-
- C> CP FILE1.C FILE2.C FILE3.C
-
- Second, you may use the "*" and "?" wild cards in your file specification.
- For example:
-
- C> CP *.C
-
- ... or ...
-
- C> CP FILE?.C
-
- Third, you may process a file listing by entering the file listing name
- immediately preceded by the @ symbol. For example:
-
- C> CP @MYFILES.LST
-
- The file must be in standard ASCII format. You may create these files with
- any text editor. Each file name must be placed on a separate line. The number
- of files you may enter in the file listing is limited to 100 when you are
- reformatting source code and by the size of the print queue when you are
- printing source code. You may modify the size of the print queue with the
- PRINT /Q:queuesize command. Legal values for queuesize range from 1 to 32.
- The default value is 10.
-
- CodePrint makes use of the DOS PRINT spooler. That means you do not have to
- wait for the printer to finish before you can continue to use your computer
- for other tasks. CodePrint just loads files to print in the print queue and
- immediately returns control of the keyboard to you.
-
-
- KEYWORD TEMPLATES
-
- The keyword template is list of keywords for a programming language. The
- templates also contain special characters that control the auto-indent feature.
- You are free to edit the templates. They are provided in ASCII format. Special
- characters have been added to the list of keywords for the purpose of
- controlling the indenting. Below are samples of indent symbols and their
- meanings:
-
- Symbol Meaning
-
- [> If the keyword is the first token on the line, indent right
- after the line.
-
- ]> If the keyword is last token on the line, indent right after the
- line.
-
- <[]> If the keyword is both the first and last (the only) token on
- the line, indent left before the line and indent right after the
- line.
-
- [- If the keyword is the first token on the line, indent right on
- the next line only.
-
- ! This keyword signifies an exception to the indent rules and
- triggers special handling.
-
-
- ERROR MESSAGES
-
- The following is a complete list of error messages. You may encounter some of
- them as you process source files with CodePrint. Corrective actions and/or
- brief explanations are provided after each error message.
-
- 01. Incorrect DOS version.
-
- CodePrint requires DOS version 3.1 or a later version.
-
- 02. Printer not ready.
-
- The printer is not available, not powered on, not on-line or out of paper.
-
- 03. Source file not found: <source file name>.
-
- The source file does not exist.
-
- 04. Source code nesting too deep.
-
- CodePrint cannot process source files with nesting deeper than 20 indent
- levels.
-
- 05. Illegal argument in CP option: /Bn.
-
- The range for legal arguments to the /B option is 0 thru 60.
-
- 06. Illegal argument in CP option: /Gn.
-
- The range for legal arguments to the /G option is 0 thru 6.
-
- 07. Illegal argument in CP option: /Jn.
-
- The range for legal arguments to the /J option is -138 thru 138.
-
- 08. Illegal argument in CP option: /Kn.
-
- The range for legal arguments to the /K option is 0 thru 3.
-
- 09. Illegal argument in CP option: /Mn.
-
- The range for legal arguments to the /M option is 0 thru 16.
-
- 10. Illegal argument in CP option: /Tn.
-
- The range for legal arguments to the /T option is 0 thru 8.
-
- 11. Illegal argument in CP option: /Vn.
-
- The range for legal arguments to the /V option is 0 thru 8.
-
- 12. Illegal argument in CP option: /Wn.
-
- The range for legal arguments to the /W option is 1.0 thru 18.0.
-
- 13. Illegal argument in CP option: /Yn.
-
- The range for legal arguments to the /Y option is 0 thru 2.
-
- 14. No extension supplied in source file name.
-
- A file name extension must be supplied for the source file name.
-
- 15. Unrecognized source file extension.
-
- The recognized source file extensions for the C language are ".c" and ".h".
-
- 16. Unrecognized CP option: <option>.
-
- The recognized CP options are: /A /Bn /C /D /E /F /Gn /H /I /Jn /Kn /L
- /Mn /N /O /Pn /Q /R /S /Tn /U /Vn /Wn /X /Yn /Z.
-
- 17. Print executive/com file not found.
-
- To enable printing, CodePrint requires that PRINT.EXE or PRINT.COM be
- located in the DOS directory, C:\DOS, or the main directory, C:\.
-
- 18. Too many bytes per line.
-
- CodePrint cannot process source files with more than 512 bytes per line.
-
- 19. Too many tokens per line.
-
- CodePrint cannot process source files with more than 250 tokens per line.
-
- 20. Keyword file not found: <keyword file>.
-
- The keyword file does not exist.
-
- 21. Too many keywords in keyword file: <keyword file>.
-
- CodePrint cannot process keyword template files with more than 250 keyword
- entries.
-
- 22. Source listing file not found: <source listing file>.
-
- The source listing file does not exist.
-
- 23. Too many source files: <number of source files>.
-
- CodePrint cannot process more than 100 source files in batch mode.
-
- 24. Print queue is full.
-
- CodePrint uses the DOS PRINT command to process source files in batch mode.
- The number of files CodePrint can process at any one time is limited to the
- number of files specified in the PRINT /Q:queuesize command. Legal values
- range from 0 to 32. The default is 10.
-
- 25. Disk is full.
-
- CodePrint cannot write output to the hard drive because the disk is full.
- You can remedy this by freeing up space on your hard drive.
-
- 26. The CP environment variable has not been set.
-
- This variable is set when you install the software. The installation
- procedure stores this value in CPINI.BAT. You can also set environment
- variables from the DOS command line with SET CP=<options>.
-
- 27. The DRIVE environment variable has not been set.
-
- This variable is set when you install the software. The installation
- procedure stores this value in CPINI.BAT. You can also set environment
- variables from the DOS command line with SET DRIVE=<destination drive>.
-
-
-